<template>
  <div class="content-wrap">
    <el-descriptions title="" :column="3">
      <el-descriptions-item label="订单号">
        {{ info.orderid }}
      </el-descriptions-item>
      <el-descriptions-item label="订单状态">{{
        info.orderstatus
      }}</el-descriptions-item>

      <el-descriptions-item label="门店编码">{{
        info.placepointid
      }}</el-descriptions-item>
      <el-descriptions-item label="门店名称">{{
        info.placepointname
      }}</el-descriptions-item>
      <el-descriptions-item label="商家承担优惠金额"
        >￥{{ info.discount || 0 }}</el-descriptions-item
      >
      <el-descriptions-item label="订单流水号">{{
        info.orderindex
      }}</el-descriptions-item>
      <el-descriptions-item label="配送方式">{{
        info.deliverystationno == -1 ? "自提" : "配送"
      }}</el-descriptions-item>
      <el-descriptions-item label="医疗机构">{{
        info.medicalinstitution
      }}</el-descriptions-item>
      <el-descriptions-item label="处方编码">{{
        info.prescriptionid
      }}</el-descriptions-item>
      <el-descriptions-item label="开方科室">{{
        info.category
      }}</el-descriptions-item>
      <el-descriptions-item label="患者姓名">{{
        info.usedrugname
      }}</el-descriptions-item>
      <el-descriptions-item label="性别">{{
        gend[info.sex]
      }}</el-descriptions-item>
      <el-descriptions-item label="患者电话">{{
        info.identitynumber
      }}</el-descriptions-item>
      <el-descriptions-item label="开单医生">{{
        info.doctor
      }}</el-descriptions-item>
      <el-descriptions-item label="支付方式">{{
        PAY_TYPE[info.orderpaytype]
      }}</el-descriptions-item>
      <el-descriptions-item label="支付时间">{{
        info.payDate
      }}</el-descriptions-item>
      <el-descriptions-item label="开方日期">{{
        info.prescriptiondate
      }}</el-descriptions-item>
      <el-descriptions-item label="创建时间">{{
        info.redate
      }}</el-descriptions-item>
      <el-descriptions-item label="推送状态">{{
        info.status
      }}</el-descriptions-item>
    </el-descriptions>
    <el-table
      :data="medicalRecordDiagnosisList"
      border
      style="width: 100%; margin-top: 30px"
    >
      <el-table-column label="订单号" align="center" prop="orderid" />
      <el-table-column label="医院的商品编码" align="center" prop="skuid" />
      <el-table-column label="erp的商品编码" align="center" prop="goodsid" />
      <el-table-column label="erp的商品名称" align="center" prop="goodsname" />
      <el-table-column label="单价" align="center" prop="price" />
      <el-table-column label="数量" align="center" prop="goodsqty" />
      <el-table-column label="金额" align="center" prop="money" />
    </el-table>
  </div>
</template>

<script>
import { getStoreOrders, listStoreOrdersDetails } from "@/api/hl/rx";
export default {
  props: ["id"],
  dicts: ["yy_voucher_type", "yy_status_type"],
  data() {
    return {
      // 假设有初始数据
      medicalRecordDiagnosisList: [],
      info: null, //处方信息
      PAY_TYPE: {
        1: "货到付款",
        4: "在线支付",
        6: "到店支付",
        "": "无",
      }, 
      gend: { 0: "未知", 1: "男", 2: "女", 9: "未说明" },
    };
  },
  created() {
    this.getDetail(); // 订单信息
    this.getList(); // 订单明细列表
  },
  methods: {
    // 订单明细列表
    getList() {
      listStoreOrdersDetails({ id: this.id }).then((response) => {
        this.medicalRecordDiagnosisList = response.rows;
      });
    },
    // 订单信息
    getDetail() {
      getStoreOrders(this.id).then((response) => {
        this.info = response.data;
      });
    },
  },
};
</script>
<style scoped lang="scss">
.content-wrap {
  padding: 32px 0 32px 0;
}
</style>
